using System.Text;

namespace OracleInternal.SqlAndPlsqlParser.LocalParsing
{
	internal class OracleLpQteSubquery : OracleLpQueryTableExpression
	{
		protected OracleLpSubquery m_vSubquery;

		public override OracleLpQueryTableExpressionType QueryTableExpressionType => OracleLpQueryTableExpressionType.Subquery;

		public OracleLpSubquery Subquery
		{
			get
			{
				return m_vSubquery;
			}
			set
			{
				m_vSubquery = value;
				if (m_vSubquery != null)
				{
					m_vSubquery.Parent = this;
				}
			}
		}

		public OracleLpQteSubquery(OracleLpStatementElement tr)
			: base(tr)
		{
		}

		public override void Resolve()
		{
			m_vColumnDescriptors = m_vSubquery.ColumnDescriptors;
		}

		public override void RetrieveNamedObjectReferences(OracleLpStatement statement)
		{
			m_vSubquery.RetrieveNamedObjectReferences(statement);
		}

		internal override void ToString(StringBuilder sb)
		{
			base.ToString(sb);
			m_vSubquery.ToString(sb);
		}
	}
}
